package com.lcf.app.knife4jopenapi3.controller;

import com.lcf.app.knife4jopenapi3.model.User;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

/**
 * @author ChenFei
 * @date 2021/11/3
 */
@Tag(name = "用户管理接口")
@RestController
@RequestMapping("user")
public class UserController {

    @Operation(summary = "查询")
    @Parameters({
            @Parameter(name = "id", description = "用户ID", in = ParameterIn.PATH)
    })
    @GetMapping("/{id}")
    public User getUser(@PathVariable("id") String id) {
        return new User();
    }

    @Operation(summary = "添加", hidden = true)
    @PostMapping("/")
    public Boolean save(@RequestBody User user) {
        return true;
    }

    @Operation(summary = "编辑")
    @PutMapping("/")
    public Boolean update(@RequestBody User user) {
        return true;
    }

    @Operation(summary = "删除")
    @Parameters({
            @Parameter(name = "id", description = "用户ID", in = ParameterIn.PATH)
    })
    @DeleteMapping("/{id}")
    public Boolean remove(@PathVariable("id") String id) {
        return true;
    }

}
